<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Withdraw
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property int $coin_id 币种ID
 * @property string|null $hash 区块链交易ID
 * @property float $number 提现数量
 * @property float $fee 提现手续费
 * @property string $address 提现地址
 * @property string|null $note 地址备注
 * @property string|null $tag 地址标签
 * @property int|null $status 提现状态: 0:审核中 1:已到账 2:已撤销 3:审核通过未处理 4:处理中
 * @property \Illuminate\Support\Carbon|null $created_at 提现时间
 * @property \Illuminate\Support\Carbon|null $updated_at 到账时间
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereCoinId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereFee($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereHash($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereNote($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereTag($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Withdraw whereUserId($value)
 * @mixin \Eloquent
 */
class Withdraw extends Model
{
    protected $table = 'withdraws';

    // 审核中
    const STATUS_CHECKING = 0;
    // 已完成
    const STATUS_SUCCESS = 1;
    // 已撤销
    const STATUS_CANCEL = 2;
    // 审核通过未处理
    const STATUS_WAITING = 3;
    // 处理中
    const STATUS_PENDING = 4;

    public function number()
    {
        return $this->number - $this->fee;
    }
}
